<template>
  <div class="createdApiForm">
    <el-form ref="form" :model="form" label-width="80px" label-position="top" v-if="JSON.stringify(editData) !== '{}'">
      <!--头-->
      <apiHeader :form="form"  :editData="editData" @changeFormFun="changeFormFun"></apiHeader>
      <!--请求头部-->
      <requestheader :form="form" :editData="editData"  @changeFormFun="changeFormFun"></requestheader>
      <!--Query 参数-->
      <requestquery :form="form"  :editData="editData" @changeFormFun="changeFormFun"></requestquery>
      <!--REST 参数-->
      <requestrest :form="form"  :editData="editData" @changeFormFun="changeFormFun"></requestrest>
      <!--body请求参数-->
      <requestbody :form="form"  :editData="editData" @changeFormFun="changeFormFun"></requestbody>
      <!--返回参数-->
      <returnParameter :form="form"  :editData="editData"  @changeFormFun="changeFormFun"></returnParameter>
      <!--返回示例-->
      <returnexample :form="form"  :editData="editData"  @changeFormFun="changeFormFun"></returnexample>
    </el-form>
  </div>
</template>

<script>
  // @/views/childBlock/project/api/components/editApicontnet
  import apiHeader from './editAPI/apiHeader'
  import {
    geteditdata
  } from '@/api/apiModel/api.js'
  import requestheader from './editAPI/requestheader'
  import requestquery from './editAPI/requestquery'
  import requestrest from './editAPI/requestrest'
  import requestbody from './editAPI/apirequestbody'
  import returnParameter from './editAPI/returnParameter'
  import returnexample from './editAPI/returnexample'
  export default {
    name: 'apiDescribe',
    data() {
      return {
        form: {
          state: '',
          apiPath: '',
          httpSelect: 'https',
          requestSelect: 'post',
          name: '',
          apiGroup: '',
          tags: '',
          personCharge: ''
        },
        editData: {}
      }
    },
    components: {
      apiHeader,
      requestheader,
      requestquery,
      requestrest,
      requestbody,
      returnParameter,
      returnexample
    },
    mounted() {
      this.geteditdata()
    },
    methods: {
      geteditdata() {
        geteditdata(this.$route.query.id).then(res => {
          this.editData = res.data.data
        })
      },
      changeFormFun(data) {
        this.form = data
        console.log(this.form)
      }
    }
  }
</script>

<style scoped>

</style>
